#ifndef TCPCLIENT_H
#define TCPCLIENT_H

#include <QObject>
#include <QtNetwork>
#include <QStringList>

class TcpClient : public QObject
{
    Q_OBJECT
public:
    explicit TcpClient(QObject *parent, QString ipstart, QString ipend, quint16 port, quint16 id, int timeout);
    void sendParticle(int velocity);
    QObject *parent;
    QHostAddress partAddrToConnect;
    quint16 port;
    quint16 partPortToConnect;

    int velocity;
    int electric_field;
    int magnetic_field;
    int timeout;
    bool initialized;

private:
    void decrypt(QByteArray& data);
    quint16 id;
    QTcpSocket *client;
    QTcpSocket *partToConnect;

public:
signals:
    void clientReady();
    void signalToLunch();

public slots:
    void readData();
    void connectedToHost();
    void lunch();
    void stateChanged(QAbstractSocket::SocketState);

};

#endif // TCPCLIENT_H
